package com.fanshuai2.niuke.monitor;

import java.util.*;

public class Demension {
    static class Operate {
        char ch;
        int step;
        public Operate(char ch, int step) {
            this.ch = ch;
            this.step = step;
        }
    }
    static class Point {
        int x;
        int y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    static Point move(Point init, List<Operate> ops) {
        if (ops == null || ops.size() == 0) {
            return init;
        }
        for (Operate op: ops) {
            char ch = op.ch;
            if (ch == 'A') {
                init.x -= op.step;
            }
            if (ch == 'D') {
                init.x += op.step;
            }
            if (ch == 'W') {
                init.y += op.step;
            }
            if (ch == 'S') {
                init.y -= op.step;
            }
        }

        return init;
    }
    static List<Operate> getOp(String line) {
        if (null == line || line.length() == 0) {
            return new ArrayList<>();
        }

        List<Operate> ops = new ArrayList<>();
        String[] arr = line.split(";");
        for (String s: arr) {
            if (s.length() == 0
                    || s.length() == 1 || s.length() > 3)
            {
                continue;
            }
            char[] chs = s.toCharArray();

            char ch = chs[0];
            if (ch != 'A' && ch != 'D' && ch != 'W' && ch != 'S') {
                continue;
            }
            boolean numflag = true;
            for (int i = 1; i < chs.length; i++) {
                if (!(chs[i] >= '0' && chs[i] <= '9')) {
                    numflag = false;
                }
            }
            if (!numflag) {
                continue;
            }
            int step = Integer.parseInt(s.substring(1, s.length()));
            Operate op = new Operate(ch, step);
            ops.add(op);
        }

        return ops;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        while (in.hasNextLine()) {
            String line = in.nextLine();
            List<Operate> ops = getOp(line);
            Point p = new Point(0, 0);
            p = move(p, ops);
            System.out.println(p.x + "," + p.y);
        }
    }
}
